//
//  HelpViewController.m
//  mosad_hw_fin
//
//  Created by student9 on 2020/12/24.
//  Copyright © 2020 student9. All rights reserved.
//

#import "HelpViewController.h"

@interface HelpViewController ()

@end

@implementation HelpViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithRed:230/255.0 green:230/255.0  blue:250/255.0 alpha:1];
    // Do any additional setup after loading the view.
    __weak typeof(self) weakSelf = self;
    self.navigationController.navigationBar.hidden = YES;
    [self.navigationController setNavigationBarHidden:YES animated:YES];
    
    UIView *backgroundMine = [[UIView alloc]  initWithFrame:CGRectMake(0, 0, weakSelf.view.frame.size.width, weakSelf.view.frame.size.height / 2.4)];
    backgroundMine.backgroundColor = [UIColor colorWithPatternImage:[[UIImage imageNamed:@"backgroundMine.png" ]TransformtoSize:CGSizeMake(weakSelf.view.frame.size.width, weakSelf.view.frame.size.height / 2.4)]] ;
    [self.view addSubview:backgroundMine];
    

    
    UIView *borderMine = [[UIView alloc] initWithFrame: CGRectMake(0, 0, weakSelf.view.frame.size.width - 60, weakSelf.view.frame.size.height - 160)];
    borderMine.backgroundColor = [UIColor whiteColor];
    borderMine.layer.shadowColor = [UIColor blackColor].CGColor;
    borderMine.layer.shadowOpacity = 1;
    borderMine.layer.shadowRadius = 40;
    borderMine.layer.shadowOffset = CGSizeMake(70, 70);
    UIBezierPath * maskPath_borderMine = [UIBezierPath bezierPathWithRoundedRect:borderMine.bounds cornerRadius:30];
    CAShapeLayer * maskLayer_borderMine = [[CAShapeLayer alloc] init];
    maskLayer_borderMine.frame = borderMine.bounds;
    maskLayer_borderMine.path = maskPath_borderMine.CGPath;
    borderMine.layer.mask = maskLayer_borderMine;
    borderMine.layer.shouldRasterize = YES;
    borderMine.layer.masksToBounds = NO;
    borderMine.clipsToBounds = NO;
    [self.view addSubview:borderMine];
    [borderMine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(weakSelf.view.frame.size.width - 60, weakSelf.view.frame.size.height - 160));
        make.centerX.equalTo(weakSelf.view.mas_centerX);
        make.centerY.equalTo(weakSelf.view.mas_centerY);
    }];
    
    UILabel *author_label = [[UILabel alloc] initWithFrame: CGRectMake(0, 0, weakSelf.view.frame.size.width - 60, 20)];
    author_label.text = @"作者";
    author_label.textAlignment = NSTextAlignmentCenter;
    author_label.font = [UIFont fontWithName:@"FZZJ-TJHWBJW"  size:(24)];
    [self.view addSubview:author_label];
    [author_label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(weakSelf.view.frame.size.width - 60, 20));
        make.top.mas_equalTo(borderMine.mas_top).offset(30);
        make.centerX.mas_equalTo(borderMine.mas_centerX);
    }];
    
    
    UIView *head_image1 = [[UIView alloc ] initWithFrame:CGRectMake(0, 0, 100, 100)];
    head_image1.backgroundColor = [UIColor colorWithPatternImage:[[UIImage imageNamed:@"xht.jpg"] TransformtoSize:CGSizeMake(100, 100)]];
    UIBezierPath * maskPath_head1 = [UIBezierPath bezierPathWithRoundedRect:head_image1.bounds cornerRadius:head_image1.frame.size.width/2];
    CAShapeLayer * maskLayer_head1 = [[CAShapeLayer alloc] init];
    maskLayer_head1.frame = head_image1.bounds;
    maskLayer_head1.path = maskPath_head1.CGPath;
    head_image1.layer.mask = maskLayer_head1;
    UITapGestureRecognizer *tapGesturRecognizer1=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction1:)];
    [head_image1 addGestureRecognizer:tapGesturRecognizer1];
    [self.view addSubview:head_image1];
    [head_image1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(borderMine.mas_top).offset(70);
        make.size.mas_equalTo(CGSizeMake(100, 100));
        make.left.equalTo(borderMine.mas_left).offset(40);
    }];
    
    UILabel *username1 = [UILabel new];
    username1.frame = CGRectMake(0, 0, weakSelf.view.frame.size.width - 100, 50);
    username1.text = @"徐浩添";
    username1.font = [UIFont fontWithName:@"FZZJ-TJHWBJW"  size:(12)];
    username1.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:username1];
    [username1 mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(100, 20));
        make.top.mas_equalTo(head_image1.mas_bottom).offset(10);
        make.centerX.mas_equalTo(head_image1.mas_centerX);
    }];
    
    UIView *head_image2 = [[UIView alloc ] initWithFrame:CGRectMake(0, 0, 100, 100)];
    head_image2.backgroundColor = [UIColor colorWithPatternImage:[[UIImage imageNamed:@"wjy.jpg"] TransformtoSize:CGSizeMake(100, 100)]];
    UIBezierPath * maskPath_head2 = [UIBezierPath bezierPathWithRoundedRect:head_image2.bounds cornerRadius:head_image2.frame.size.width/2];
    CAShapeLayer * maskLayer_head2 = [[CAShapeLayer alloc] init];
    maskLayer_head2.frame = head_image2.bounds;
    maskLayer_head2.path = maskPath_head2.CGPath;
    head_image2.layer.mask = maskLayer_head2;
    UITapGestureRecognizer *tapGesturRecognizer2=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction2:)];
    [head_image2 addGestureRecognizer:tapGesturRecognizer2];
    [self.view addSubview:head_image2];
    [head_image2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(borderMine.mas_top).offset(70);
        make.size.mas_equalTo(CGSizeMake(100, 100));
        make.right.equalTo(borderMine.mas_right).offset(-40);
    }];
    
    UILabel *username2 = [UILabel new];
    username2.frame = CGRectMake(0, 0, weakSelf.view.frame.size.width - 100, 50);
    username2.text = @"文君逸";
    username2.font = [UIFont fontWithName:@"FZZJ-TJHWBJW"  size:(12)];
    username2.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:username2];
    [username2 mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(100, 20));
        make.top.mas_equalTo(head_image2.mas_bottom).offset(10);
        make.centerX.mas_equalTo(head_image2.mas_centerX);
    }];
    
    UIView *head_image3 = [[UIView alloc ] initWithFrame:CGRectMake(0, 0, 100, 100)];
    head_image3.backgroundColor = [UIColor colorWithPatternImage:[[UIImage imageNamed:@"xlc.jpg"] TransformtoSize:CGSizeMake(100, 100)]];
    UIBezierPath * maskPath_head3 = [UIBezierPath bezierPathWithRoundedRect:head_image3.bounds cornerRadius:head_image3.frame.size.width/2];
    CAShapeLayer * maskLayer_head3 = [[CAShapeLayer alloc] init];
    maskLayer_head3.frame = head_image3.bounds;
    maskLayer_head3.path = maskPath_head3.CGPath;
    head_image3.layer.mask = maskLayer_head3;
    UITapGestureRecognizer *tapGesturRecognizer3=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction3:)];
    [head_image3 addGestureRecognizer:tapGesturRecognizer3];
    [self.view addSubview:head_image3];
    [head_image3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(username2.mas_bottom).offset(20);
        make.size.mas_equalTo(CGSizeMake(100, 100));
        make.left.equalTo(borderMine.mas_left).offset(40);
    }];
    
    UILabel *username3 = [UILabel new];
    username3.frame = CGRectMake(0, 0, weakSelf.view.frame.size.width - 100, 50);
    username3.text = @"肖霖畅";
    username3.font = [UIFont fontWithName:@"FZZJ-TJHWBJW"  size:(12)];
    username3.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:username3];
    [username3 mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(100, 20));
        make.top.mas_equalTo(head_image3.mas_bottom).offset(10);
        make.centerX.mas_equalTo(head_image3.mas_centerX);
    }];
    
    UIView *head_image4 = [[UIView alloc ] initWithFrame:CGRectMake(0, 0, 100, 100)];
    head_image4.backgroundColor = [UIColor colorWithPatternImage:[[UIImage imageNamed:@"wyw.jpg"] TransformtoSize:CGSizeMake(100, 100)]];
    UIBezierPath * maskPath_head4 = [UIBezierPath bezierPathWithRoundedRect:head_image4.bounds cornerRadius:head_image4.frame.size.width/2];
    CAShapeLayer * maskLayer_head4 = [[CAShapeLayer alloc] init];
    maskLayer_head4.frame = head_image4.bounds;
    maskLayer_head4.path = maskPath_head4.CGPath;
    head_image4.layer.mask = maskLayer_head4;
    UITapGestureRecognizer *tapGesturRecognizer4 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction4:)];
    [head_image4 addGestureRecognizer:tapGesturRecognizer4];
    [self.view addSubview:head_image4];
    [head_image4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(username2.mas_bottom).offset(20);
        make.size.mas_equalTo(CGSizeMake(100, 100));
        make.right.equalTo(borderMine.mas_right).offset(-40);
    }];
    
    UILabel *username4 = [UILabel new];
    username4.frame = CGRectMake(0, 0, weakSelf.view.frame.size.width - 100, 50);
    username4.text = @"王裕文";
    username4.font = [UIFont fontWithName:@"FZZJ-TJHWBJW"  size:(12)];
    username4.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:username4];
    [username4 mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(100, 20));
        make.top.mas_equalTo(head_image4.mas_bottom).offset(10);
        make.centerX.mas_equalTo(head_image4.mas_centerX);
    }];
    
    UILabel *beautiful_label = [[UILabel alloc] initWithFrame: CGRectMake(0, 0, weakSelf.view.frame.size.width - 60, 200)];
    beautiful_label.text = @"蓦然回首";
    beautiful_label.textAlignment = NSTextAlignmentCenter;
    beautiful_label.font = [UIFont fontWithName:@"FZZJ-TJHWBJW"  size:(18)];
    [self.view addSubview:beautiful_label];
    [beautiful_label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(weakSelf.view.frame.size.width - 60, 20));
        make.top.mas_equalTo(username3.mas_bottom).offset(40);
        make.centerX.mas_equalTo(borderMine.mas_centerX);
    }];
    
    UILabel *beautiful2_label = [[UILabel alloc] initWithFrame: CGRectMake(0, 0, weakSelf.view.frame.size.width - 60, 200)];
    beautiful2_label.text = @"那人却在，灯火阑珊处";
    beautiful2_label.textAlignment = NSTextAlignmentCenter;
    beautiful2_label.font = [UIFont fontWithName:@"FZZJ-TJHWBJW"  size:(18)];
    [self.view addSubview:beautiful2_label];
    [beautiful2_label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(weakSelf.view.frame.size.width - 60, 20));
        make.top.mas_equalTo(beautiful_label.mas_bottom).offset(20);
        make.centerX.mas_equalTo(borderMine.mas_centerX);
    }];
    
    UIButton *back_btn;
    back_btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    back_btn.frame = CGRectMake(0, 0, 40, 40);
    back_btn.backgroundColor = [UIColor colorWithPatternImage:[[UIImage imageNamed:@"leftarrow.png"] TransformtoSize:CGSizeMake(40, 40)]];
    [back_btn addTarget:self
                 action:@selector(back_to_mine:)
       forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:back_btn];
    [back_btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.view).offset(30);
        make.left.equalTo(weakSelf.view).offset(20);
        make.size.mas_equalTo(CGSizeMake(40, 40));
    }];
}

-(void)showAlertMsg {
    dispatch_async(dispatch_get_main_queue(), ^{
        UIView *showview =  [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width - 280, 60)];
        showview.backgroundColor = [UIColor blackColor];
        showview.alpha = 1.0f;
        showview.layer.cornerRadius = 5.0f;
        showview.layer.masksToBounds = YES;
        [self.view addSubview:showview];
        
        UILabel *str_label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width - 280, 60)];
        str_label.textColor = [UIColor whiteColor];
        str_label.textAlignment = NSTextAlignmentCenter;
        str_label.text = @"复制成功";
        [showview addSubview:str_label];
        [str_label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width - 280, 60));
            make.centerY.mas_equalTo(showview.mas_centerY);
            make.centerX.mas_equalTo(showview.mas_centerX);
        }];
        
        [showview mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width - 280, 60));
            make.centerX.mas_equalTo(self.view.mas_centerX);
            make.centerY.mas_equalTo(self.view.mas_centerY);
        }];
        [UIView animateWithDuration:1 animations:^{
            showview.alpha = 0;
        } completion:^(BOOL finished) {
            [showview removeFromSuperview];
        }];
    });
}


-(void)tapAction1:(id)tap {
    UIActionSheet *sheet = [[UIActionSheet alloc]initWithTitle:@"微信号" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles: @"xht1220298052", nil];
    [sheet showInView:self.view];
    UIPasteboard *pab = [UIPasteboard generalPasteboard];
    pab.string = @"xht1220298052";
    
}

-(void)tapAction2:(id)tap {
    UIActionSheet *sheet = [[UIActionSheet alloc]initWithTitle:@"微信号" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles: @"PHONY_BETTER", nil];
    [sheet showInView:self.view];
    UIPasteboard *pab = [UIPasteboard generalPasteboard];
    pab.string = @"PHONY_BETTER";
}

-(void)tapAction3:(id)tap {
    UIActionSheet *sheet = [[UIActionSheet alloc]initWithTitle:@"微信号" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles: @"xlc_bingo1999", nil];
    [sheet showInView:self.view];
    UIPasteboard *pab = [UIPasteboard generalPasteboard];
    pab.string = @"xlc_bingo1999";
}

-(void)tapAction4:(id)tap {
    UIActionSheet *sheet = [[UIActionSheet alloc]initWithTitle:@"微信号" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles: @"wyw19991003vvv", nil];
    [sheet showInView:self.view];
    UIPasteboard *pab = [UIPasteboard generalPasteboard];
    pab.string = @"wyw19991003vvv";
}

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
    if (buttonIndex == 0) {
        [self showAlertMsg];
    }
}

- (void)back_to_mine:(UIButton *)buttonView {
    NSLog(@"back_to_mine");
    [self.navigationController popViewControllerAnimated:NO];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
